package com.jerkin.jieba;

import com.alibaba.excel.EasyExcel;

import com.jerkin.jieba.model.GsCodeModel;

import java.util.ArrayList;
import java.util.List;

/**
 * @description:
 * @className:GsCodeWriteData
 * @author:huhongzhi
 * @createTime:2021/3/15 10:59
 * @version:1.0
 */
public class GsCodeWriteData {

    public static final List<GsCodeModel> GS_CODE_MODELS = new ArrayList<>(35000);

    public static void add(GsCodeModel gsCodeModel) {
        GS_CODE_MODELS.add(gsCodeModel);
    }

    public static void startWrite(String model) {

        String filename = "C:\\Users\\huain\\Desktop\\"+model+".xlsx";
        // 2 调用easyexcel里面的方法实现写操作
        // write方法两个参数：第一个参数文件路径名称，第二个参数实体类class
        EasyExcel.write(filename,GsCodeModel.class).sheet("分词").doWrite(GS_CODE_MODELS);
        System.out.println("写入完毕");
    }
}